import { createStore, combineReducers, applyMiddleware } from 'redux';
import reducers from './reducers';
// 使得dispatch能够接收函数
import thunk from 'redux-thunk';
//默认数据
let state = {
    from: '北京',
    to: '上海',
    //城市选择浮层是否可见
    isCitySelectVisible: false,
    //城市选择后返回的选择城市,初始值用false来替代
    currentSelectLeftCity: false,
    //异步加载的城市列表数据
    cityData: null,
    isLoadingCityData: false,
    //是否显示 日期选择浮层
    isDateSelectVisible: false,
    //选择日期
    departDate: Date.now(),
    //是否选择高铁动车
    highSpeed: false,
};

const store = createStore(
    combineReducers(reducers),
    //state的默认值
    state,
    applyMiddleware(thunk)
);

// const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
// const store = createStore(
//   combineReducers(reducers),
//   state,
//   composeEnhancers(applyMiddleware(thunk))
// )

export default store;
